package cn.itcalvin.sncoal.cth.controller;

import cn.itcalvin.sncoal.cth.aspect.LogAnnotation;
import cn.itcalvin.sncoal.cth.aspect.NotAuthAnnotation;
import cn.itcalvin.sncoal.cth.pojo.common.ReqLogin;
import cn.itcalvin.sncoal.cth.pojo.common.RespUserInfo;
import cn.itcalvin.sncoal.cth.service.InfoUserService;
import cn.itcalvin.vo.Message;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

@Api(tags = "登录认证")
@RestController
@RequestMapping("/api/auth")
public class AuthController {

    @Resource
    InfoUserService infoUserService;

    @PostMapping("/login")
    @NotAuthAnnotation
    @LogAnnotation(value = "登录接口",logType = 1)
    @ApiOperation(value = "登录接口")
    public Message<RespUserInfo> login(@RequestBody @Valid ReqLogin reqLogin){
        return infoUserService.login(reqLogin);
    }



}
